package com.iflytek.esb.domain;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;

import net.sf.json.JSONObject;

public class Queue implements Serializable {

	private static final long serialVersionUID = 5841101651261656225L;
	private long id;
	private Map<String, Object> data = new HashMap<String, Object>();
	private long inTime;
	private long dueTime;

	public long getId() {
		return id;
	}

	public void setId(long id) {
		this.id = id;
	}

	public Map<String, Object> getData() {
		return data;
	}

	public void setData(Map<String, Object> data) {
		this.data = data;
	}

	public long getInTime() {
		return inTime;
	}

	public void setInTime(long inTime) {
		this.inTime = inTime;
	}

	public long getDueTime() {
		return dueTime;
	}

	public void setDueTime(long dueTime) {
		this.dueTime = dueTime;
	}

	public String getData__() {
		JSONObject json = JSONObject.fromObject(data);
		return json.toString();
	}
	
	@SuppressWarnings("unchecked")
	public void setData__(String data__) {
		JSONObject json = JSONObject.fromObject(data__);
		Iterator<String> iter = json.keys();
		while (iter.hasNext()) {
			String key = iter.next();
			String value = json.getString(key);
			data.put(key, value);
		}
	}
}
